/**
 * 作者:李杰
 * email: maillijie@gmail.com
 */
package com.javainfo.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Type;

@Entity
public class Attachments {

	public static final String IMAGE ="image";
	
	public static final String FLASH ="flash";
	
	public static final String COMPRESS = "compress";
	
	public static final String OTHER = "other";
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;

	private Boolean isSystemFile;
	
	private String fileName;
	private String comment;

	@Type(type="org.springframework.orm.hibernate3.support.BlobByteArrayType")
	private byte[] content;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	private User uploadUser;
	
	private Date uploadTime;
	
	private Date updateTime;
	
	private String fileType;
	
	private Boolean hasSaveToDB;
	
	private String uploadedPath;
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "attachmentsId")
	private Set<Article> articleSet;
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "attachmentsId")
	private Set<SubArticle> subArticleSet;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public byte[] getContent() {
		return content;
	}

	public void setContent(byte[] content) {
		this.content = content;
	}

	public User getUploadUser() {
		return uploadUser;
	}

	public void setUploadUser(User uploadUser) {
		this.uploadUser = uploadUser;
	}

	public Date getUploadTime() {
		return uploadTime;
	}

	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	public Set<Article> getArticleSet() {
		return articleSet;
	}

	public void setArticleSet(Set<Article> articleSet) {
		this.articleSet = articleSet;
	}

	public Set<SubArticle> getSubArticleSet() {
		return subArticleSet;
	}

	public void setSubArticleSet(Set<SubArticle> subArticleSet) {
		this.subArticleSet = subArticleSet;
	}

	public Boolean getIsSystemFile() {
		return isSystemFile;
	}

	public void setIsSystemFile(Boolean isSystemFile) {
		this.isSystemFile = isSystemFile;
	}

	public Boolean getHasSaveToDB() {
		return hasSaveToDB;
	}

	public void setHasSaveToDB(Boolean hasSaveToDB) {
		this.hasSaveToDB = hasSaveToDB;
	}

	public String getUploadedPath() {
		return uploadedPath;
	}

	public void setUploadedPath(String uploadedPath) {
		this.uploadedPath = uploadedPath;
	}
	
}
